package com.selebash.features;

import java.lang.reflect.Method;
import java.util.Objects;
import java.util.regex.Pattern;

/**
 * @author sad
 */
public class FeatureHolder {

    private Pattern pattern;
    private Object objectFeatureOwner;
    private Method method;
    private boolean hasNested;

    public boolean isHasNested() {
        return hasNested;
    }

    public void setHasNested(boolean hasNested) {
        this.hasNested = hasNested;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Object getObjectFeatureOwner() {
        return objectFeatureOwner;
    }

    public void setObjectFeatureOwner(Object objectFeatureOwner) {
        this.objectFeatureOwner = objectFeatureOwner;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 71 * hash + Objects.hashCode(this.pattern.pattern());
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final FeatureHolder other = (FeatureHolder) obj;
        if (!Objects.equals(this.pattern.pattern(), other.pattern.pattern())) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return objectFeatureOwner.getClass().getName()+":"+method.getName()+":"+pattern.pattern();
    }

    
}
